<?php
	$link_root = Router::url('/');
	$link_invite =$link_root. "pharmacies/invite/";
    $link_view =$link_root. "pharmacies/view_locum_profile/";
?>


<!--RESULT-->
<div class="result">

<?php foreach ( $a_Locum as $Locum ) :
        if($Locum['Locum']['Avatar'])
        {
        	$url_image = Router::url('/').'app/webroot/img/avatar/'.$Locum['Locum']['Avatar']; 
        }else
        {
           $url_image = Router::url('/') . 'app/webroot/img/avatar.jpg';
        }
        
        if(!empty($Locum['Event']['date']))
        {
	        $a_Event = explode(',',$Locum['Event']['date']);
	        $a_Temps = array();
	        if($a_Event)
	        {
	            foreach($a_Event as $event)
	            {
	                $a_Temps[] = strtotime($event);
	            }
	        }
	        sort($a_Temps);
	        $i_currentMonth = date('n');
	       // $a_EventMonth = explode('-',date('m'));
	        $i_eventMonth = date('m',$a_Temps[0]);
	        $jump = $i_eventMonth - $i_currentMonth;
        }else
        {
        	$jump = 0;
        }
?>

<!--RESULT WRAP-->
<div class="result_wrap">

<!--COLUMN 1-->
<div class="FourColGrid_c1">
<div id="myAvatar"><img src="<?php echo $url_image; ?>" width="100" alt="Pharmacy Shop picture"></div>
<a href="<?php echo $link_view . $Locum['Locum']['id']; ?>" class="TitleFive">View</a>
<a href="<?php echo $link_invite . $Locum['Locum']['id']; ?>" class="TitleFive">Invite</a>
</div>
<!--COLUMN 1-->

<!--COLUMN 2-->
<div class="FourColGrid_c2">
<h4 class="TitleTwo"><?php echo $Locum['Locum']['Username']?></h4>
<p><b>County - </b><?php echo $GLOBALS['Country'][$Locum['Locum']['Country_id']];?><br>
<b>Member since - </b> <?php echo date('Y-m-d', strtotime($Locum['Locum']['MatchMemberSince']))?><br><br>
<img src="<?php echo Router::url('/')?>app/webroot/img/stars_<?php echo $Locum['Locum']['i_RateAVG']?>.png" alt="rating">
</div>
<!--COLUMN 2-->

<!--COLUMN 3-->
<div class="FourColGrid_c3">
<div class="eventCalendarNoCache_<?php echo $Locum['Locum']['id']?>"></div>
<script>
$(document).ready(function() {
$(".eventCalendarNoCache_"+<?php echo $Locum['Locum']['id']?>).eventCalendar({
	eventsjson: '<?php echo Router::url('/').'searches/getJson/'.$Locum['Locum']['id'] ?>',
	cacheJson: false,
	multiple: true,
	allowClick:false,
	onlychoose:true,
	jumpMonth:'<?php echo $jump ?>'
});
});
</script>   
<ul class="listTwo">
<li class="unavailable"> = Locum unavailable</li>
<li class="available"> = Locum available</li>
</ul>     
</div>
<!--COLUMN 3-->

<br class="clear"/>
</div>
<!--RESULT WRAP-->

<?php endforeach;?>

</div>
<!--RESULT-->

<!--COLUMN 4-->
<div class="FourColGrid_c4">
<h6 class="TitleFive">Locum Search</h6>
<?php echo $this->element('search_for_pharmacy');?>
<br>
<?php echo $this->element('invite_pharmacy');?>
</div>
<!--COLUMN 4-->
<br class="clear"/>

<?php if(count ($a_Locum) == 0):?>
<?php else:?>
<!--WRAP-->
<div class="paginate">
<?php $paginator->options = array('url'=>array("?" =>$sz_params))?> 
Showing Page <?php echo $paginator->counter(); ?> &nbsp;&nbsp;&nbsp;
<?php echo $paginator->prev(); ?>&nbsp;
<?php echo $paginator->numbers(); ?>&nbsp;
<?php echo $paginator->next(); ?> 
<?php endif;?>
</div>
<!--WRAP-->
